<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<h1>TkWebView</h1>
<p>TkWebView is a Tk widget based on the htmllib package and browser client developed by Stephen Uhler and maintained by Clif Flynt. It is intended to provide a lightweight HTML viewer for applications, either as a standalone window or as an embedded widget. 

<p>The source code for the original htmllib package is included in the htmllib-rel_0_3_4.zip file. 

<p>The same BSD-style license that applies to the older version of the package applies to the current modifications; see license.terms. The modifications are summarized in the documentation and are annotated in the source code with comments.
<h1>How to Use TkWebView
</h1>
<p>Under the hood, TkWebView is very complex, but it can be implemented very simply in an application. There are three main processes one can use:

<ul>
  <li><code>proc WebViewStandalonewidget {title file}</code> for a standalone toplevel HTML viewer, where<em> title</em> is the window title and <em>file</em> is the HTML file to be displayed.  </li>
  <li><code>proc WebView_Helpviewer {file}</code> for a specialized standalone viewer for user help, where<em> file </em>is the HTML to be displayed. </li>
  <li><code>proc WebView_Embeddedwidget {w file}</code> where w is the parent widget and <em>file</em> is the HTML file to be displayed. </li>
</ul>
<p>See the demo source code in webview.tcl for more detailed examples on how to implement this widget in your application.</p>
<h1>Details</h1>
<h3>HTML </h3>
<p>TkWebView is not a general-purpose web browser, unlike TkHTML. It handles basic HTML only, and does not support tables, CSS, JavaScript, or other components of modern web browsers. 

<h3>Global Variables
  
</h3>
<p>The HTML-rendering code that is at the core of TkWebView dates back to the mid-1990s. While it still works perfectly today, its organization pre-dates the use of modern Tcl coding practices such as namespaces. As a result, it (and consequently TkWebView) makes extensive use of global variables. In calling some procedures from TkWebView, it may be necessary to include these global variables in the proc:

<p><code>WebView_ClickLink WebView_Library WebView WebView_Viewwindow HMHome</code>

<p>These variables have been named with the "HM" or "WebView" prefix to avoid conflicts with other variable names. 
  
<h3>Event Handling</h3>
<p>TkWebView provides procedure names for developers to use in accessing URL's other than the local filesystem: HTTP, FTP, and so on. Because different developers may have different needs for these protocols, and because they vary by platform,  you will have to implement these procedures yourself. These procedures take a hyperlink as an argument. Be sure to include the global variables if you include these methods.

<code><p>#http://<br>
proc WebView_HTTP {link} {<br>
    global WebView_ClickLink WebView_Library WebView WebView_Viewwindow<br>
}<br />
<br>

#https://<br>
proc WebView_HTTPS {link} {<br>
    global WebView_ClickLink WebView_Library WebView WebView_Viewwindow<br>

}<br />
<br>

#ftp://<br>
proc WebView_FTP {link} {<br>
    global WebView_ClickLink WebView_Library WebView WebView_Viewwindow<br>

}<br />
<br>

#sftp://<br>
proc WebView_SFTP {link} {<br>
    global WebView_ClickLink WebView WebView_Library WebView_Viewwindow<br>

}<br />
<br>

#mailto:<br>
proc WebView_Mailto {link} {<br>
    global WebView_ClickLink WebView_Library WebView WebView_Viewwindow<br>

}</p></code>
<h3>Image Resizing</h3>
<p>TkWebView has an optional dependency on TkCxImage, available from <a href="https://amsn.svn.sourceforge.net/svnroot/amsn/trunk/amsn/utils/TkCximage/.">https://amsn.svn.sourceforge.net/svnroot/amsn/trunk/amsn/utils/TkCximage/.</a> If TkCxImage is installed, then TkWebView will resize images that have "width-height" tags in HTML. If it is not installed, TkWebView will render the images at full size.
</body>
</html>
